#ifndef CRENDERPLAYER_H
#define CRENDERPLAYER_H

#include "../include/IRenderEntity.h"

union SDL_Event;
class CPlayerBehaviour;
class CRenderEnemy;

//**************************
//Manage rendering of a player
//**************************
class CRenderPlayer : public IRenderEntity
{
    protected:
        CPlayerBehaviour * m_PlayerEntity;	//Player to render
        int m_iInitX;           //initial value on the abscissa
        int m_iInitY;           //initial value on the ordinary
        long m_lBeginBlink;     //beginning of the blinking


    public:
        //**************************
        //Description : Constructor
        //Parameters : None
        //Note : None
        //**************************
        CRenderPlayer();

        //**************************
        //Description : Constructor
        //Parameters : The screen,
        //             A pointer toward the player entity
        //             Animations for player and its shots
        //Note : None
        //**************************
        CRenderPlayer(SDL_Surface * _screen,
                        CPlayerBehaviour * _Player,
                        CSpriteAnimation * _PlayerAnimations,
                        CSpriteAnimation * _PlayerShotsAnimation);

        //**************************
        //Description : Copy Constructor
        //Parameters : A CRenderPlayer
        //Note : None
        //**************************
        CRenderPlayer(CRenderPlayer & _RenderPlayer);

        //**************************
        //Description : Destructor
        //Parameters : None
        //Note : None
        //**************************
        virtual ~CRenderPlayer();

        //**************************
        //Description : Set the initial value for the rendering
        //Parameters : The screen,
        //             A pointer toward the player entity
        //             Animations for player and its shots
        //Return Value : None
        //Note : None
        //**************************
        void SetRender(SDL_Surface * _screen,
                        CPlayerBehaviour * _Player,
                        CSpriteAnimation * _PlayerAnimations,
                        CSpriteAnimation * _PlayerShotsAnimation);

        //**************************
        //Description : Initialise the rendering to its beginning
        //Parameters : None
        //Return Value : None
        //Note : None
        //**************************
        void InitRender();

        //**************************
        //Description : Set sprites for the rendering if it's not done
        //Parameters : Animations for the player and its shots
        //Return Value : None
        //Note : None
        //**************************
        void SetSprites(CSpriteAnimation * _PlayerAnimations,
                        CSpriteAnimation * _PlayerShotsAnimation);

        //**************************
        //Description : Return the Player Entity
        //Parameters : None
        //Return Value : The player entity
        //Note : None
        //**************************
        CPlayerBehaviour * GetPlayerBehaviour() const;

        //**************************
        //Description : Set m_PlayerEntity if it's not done
        //Parameters : A pointer toward a player
        //Return Value : None
        //Note : None
        //**************************
        void SetPlayerBehaviour(CPlayerBehaviour * _Player);

        //**************************
        //Description : Render the Shot
        //Parameters : None
        //Return Value : None
        //Note : None
        //**************************
        void RenderShots();

        //**************************
        //Description : Render the Entity
        //Parameters : None
        //Return Value : None
        //Note : None
        //**************************
        void RenderEntity();

        //**************************
        //Description : Render the entity and all things that have connections with it (shots of an entity, power up after death of an enemy, ...)
        //Parameters : None
        //Return Value : None
        //Note : None
        //**************************
        void Render();

        //**************************
        //Description : Test if the player collide with the ennemy and/or its shots
        //Parameters : The enemy
        //Return Value : True if there is collision, false if not
        //Note : None
        //**************************
        bool CollideWithEnemy(CRenderEnemy * _Enemy);

        //**************************
        //Description : Test if the player is resurecting or not
        //Parameters : None
        //Return Value : True if the player is blinking (when resurection), false if not
        //Note : It allows us to don't test collision when the player don't blink
        //**************************
        bool IsResurecting() const;

        //**************************
        //Description : Test if the player is resurecting or not
        //Parameters : None
        //Return Value : True if the player is eploding, false if not
        //Note : None
        //**************************
        bool IsExploding() const;

        //**************************
        //Description : Test if the player is dead
        //Parameters : None
        //Return Value : True if the player is considered as dead, otherwise false
        //Note : The player is considered has dead when its animation of death has finished
        //**************************
        bool IsPlayerDead() const;

        //**************************
        //Description : Test if the player is touched by an enemy or a shot
        //Parameters : None
        //Return Value : True if the player is exploded (end of the animation of death), otherwise false
        //Note : The player is considered as exploded when its animation of death has finished
        //      It doesn't means that the player is TOTALLY dead
        //**************************
        bool IsPlayerExplosed() const;
};
#endif
